#!/usr/bin/env/ python
# -*- coding: utf-8


"""
@project: python-file
@author: admin
@time: 2022/6/29
"""
import utils
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

'''定义app的基类'''

# 对象库层基类封装
class BasePage:

	# 初始化app驱动
	def __init__(self):
		self.driver = utils.UtilsDriver.get_app_driver()

	# 定位单个元素
	def get_element(self, location):
		element = WebDriverWait(self.driver, 10, 1).until(EC.presence_of_element_located(location))
		return element

	# 定位多个元素
	def get_elements(self, location):
		elements = WebDriverWait(self.driver, 10, 1).until(EC.presence_of_all_elements_located(location))
		return elements


# 操作层基类封装
class BaseHandle:

	def input_text(self, element, text):
		'''输入操作'''
		element.clear()
		element.send_keys(text)
		
	def click_element(self, element):
		'''点击操作'''
		element.click()
